<style>
    .start_time{position:unset!important;}
    .start_time input{width: 110px}
    .plan_hours input{width: 50px}
    .panel-body{padding: unset;}
</style>
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <div class="row">
        <div class="col-md-4 col-xs-12 form-group">
            <label for="c-number" class="control-label col-xs-12 col-sm-2">{:__('项目编号')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-number"  type="text" class="form-control" name="row[number]" value="{$pprefix}"/>
            </div>
        </div>
        <div class="col-md-4 col-xs-12 form-group">
            <label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('项目名称')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-name" data-rule="required" type="text" class="form-control" name="row[name]" value=""/>
            </div>
        </div>
        <div class="col-md-4 col-xs-12 form-group">
            <label for="c-jobs" class="control-label col-xs-12 col-sm-2">{:__('作业内容')}:</label>
            <div class="col-xs-12 col-sm-8">
                <div class="checkbox checkbox-inline">
                    {foreach name="w_config['jobs']" item="vo"}
                    <label for="row[jobs][]-{$key}">
                        <input id="row[jobs][]-{$key}"  name="row[jobs][]" type="checkbox" value="{$key}" data-rule="checked"> {$vo}
                    </label>
                    {/foreach}
                </div>
            </div>
        </div>
        {php}
        $facrm_config=get_addon_info('facrm');
        {/php}
        {if $facrm_config}
        <div class="col-md-4 col-xs-12 form-group">
            <label for="c-customer_id" class="control-label col-xs-12 col-sm-2">{:__('客户')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-customer_id" data-rule="required" data-source="facrm/customer/index/selectpage?type=all"
                       class="form-control selectpage" name="row[customer_id]" type="text" value="" >
            </div>
        </div>
        {/if}
        <div class="col-md-4 col-xs-12 form-group {if $facrm_config} hide{/if}">
            <label for="c-customer_name" class="control-label col-xs-12 col-sm-2">{:__('客户名称')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-customer_name" data-rule="required" type="text" class="form-control" name="row[customer_name]" value=""/>
            </div>
        </div>

        <div class="col-md-4 col-xs-12 form-group">
            <label for="c-contacts_name" class="control-label col-xs-12 col-sm-2">{:__('联系人')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-contacts_name" data-rule="required" type="text" class="form-control" name="row[contacts_name]" value=""/>
            </div>
        </div>

        <div class="col-md-4 col-xs-12 form-group">
            <label for="c-order_time" class="control-label col-xs-12 col-sm-2">{:__('下单时间')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-order_time" value="{:datetime(time())}" class="form-control datetimepicker"
                       data-date-format="YYYY-MM-DD" data-use-current="true" name="row[order_time]" type="text">
            </div>
        </div>

        <div class="col-md-4 col-xs-12 form-group">
            <label for="c-price" class="control-label col-xs-12 col-sm-2">{:__('项目金额')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-price" type="number" class="form-control" name="row[price]" value=""/>
            </div>
        </div>


        <div class="col-md-4 col-xs-12 form-group">
            <label for="c-start_time" class="control-label col-xs-12 col-sm-2">{:__('开始时间')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-start_time" value="{:datetime(time())}" class="form-control datetimepicker"
                       data-date-format="YYYY-MM-DD HH:mm" data-use-current="true" name="row[start_time]" type="text">
            </div>
        </div>
        <div class="col-md-4 col-xs-12 form-group">
            <label for="c-end_time" class="control-label col-xs-12 col-sm-2">{:__('截止时间')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-end_time" value="" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm"
                       data-use-current="true" name="row[end_time]" type="text">
            </div>
        </div>

        <div class="col-md-4 col-xs-12 form-group">
            <label for="c-test_time" class="control-label col-xs-12 col-sm-2">{:__('初稿时间')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-test_time" value="" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm"
                       data-use-current="true" name="row[test_time]" type="text">
            </div>
        </div>

        <div class="col-md-4 col-xs-12 form-group">
            <label for="c-sales_admin_id" class="control-label col-xs-12 col-sm-2">{:__('业务经理')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-sales_admin_id"  data-source="workteam/common/selectpage/model/admin/type/all" data-field="nickname"
                       class="form-control selectpage" name="row[sales_admin_id]" type="text" value="" data-rule="required">

            </div>
        </div>
        <div class="col-md-4 col-xs-12 form-group">
            <label for="c-project_admin_id" class="control-label col-xs-12 col-sm-2">{:__('项目经理')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-project_admin_id"  data-source="workteam/common/selectpage/model/admin/type/all" data-field="nickname"
                       class="form-control selectpage" name="row[project_admin_id]" type="text" value="{:$auth->id}" data-rule="required">


            </div>
        </div>

        <div class="col-md-4 col-xs-12 form-group">
            <label for="c-admin_ids" class="control-label col-xs-12 col-sm-2">{:__('参与人')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input   data-source="workteam/common/selectpage/model/admin/type/all" data-field="nickname" id="c-admin_ids"
                         class="form-control selectpage" name="row[admin_ids]" type="text" value="" data-multiple="true">

            </div>
        </div>


        <div class="col-md-4 col-xs-12 form-group">
            <label for="c-plan_hours" class="control-label col-xs-12 col-sm-2">{:__('计划工时')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-plan_hours" type="number" data-rule="required" class="form-control" name="row[plan_hours]" value=""/>

            </div>
        </div>
        <div class="form-group col-md-4 col-xs-12">
            <label class="control-label col-xs-12 col-sm-2">{:__('优先级')}:</label>
            <div class="col-xs-12 col-sm-8">
                <select id="c-level" class="form-control selectpicker" name="row[level]">
                    {foreach name="levelList" item="vo"}
                    <option value="{$key}" {in name="key" value="1" }selected{/in}>{$vo}</option>
                    {/foreach}
                </select>
                <span class="text-red "></span>
            </div>
        </div>

        <div class="form-group col-md-4 col-xs-12">
            <label class="control-label col-xs-12 col-sm-2">{:__('项目状态')}:</label>
            <div class="col-xs-12 col-sm-8">
                <select id="c-status" class="form-control selectpicker" name="row[status]" disabled>
                    {foreach name="statusList" item="vo"}
                    <option value="{$key}" {in name="key" value="0" }selected{/in}>{$vo}</option>
                    {/foreach}
                </select>
                <span class="text-red ">{:__('* 归档的项目不能更改')}</span>
            </div>
        </div>

        <div class="form-group col-md-4 col-xs-12">
            <label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('附件')}:</label>
            <div class="col-xs-12 col-sm-8">
                <div class="input-group">
                    <input id="c-image" class="form-control" size="50" name="row[image]" type="text" value="" placeholder="可以为空">
                    <div class="input-group-addon no-border no-padding">
                        <span><button type="button" id="plupload-image" class="btn btn-danger  plupload" data-input-id="c-image" data-mimetype="*" data-multiple="true" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('上传')}</button></span>
                        <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="*" data-multiple="true" data-preview-id="p-image"><i class="fa fa-list"></i> {:__('选择')}</button></span>

                    </div>
                    <span class="msg-box n-right" for="c-image"></span>
                </div>
                <ul class="row list-inline plupload-preview" id="p-image"></ul>
            </div>
        </div>
        <div class="col-md-4 col-xs-12 form-group">
            <label for="c-remark" class="control-label col-xs-12 col-sm-2">{:__('备注')}:</label>
            <div class="col-xs-12 col-sm-8">
                <textarea id="c-remark" class="form-control" name="row[remark]"></textarea>
            </div>
        </div>

        <div class="col-md-4 col-xs-12 form-group">
            <label for="c-content" class="control-label col-xs-12 col-sm-2">{:__('项目说明')}:</label>
            <div class="col-xs-12 col-sm-8">
                <textarea id="c-content" class="form-control editor" name="row[content]"></textarea>

            </div>
        </div>


        <div class="col-md-4 col-xs-12 form-group">
                <label for="c-wx_webhook" class="control-label col-xs-12 col-sm-2">{:__('企微机器人')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-wx_webhook"  type="text" class="form-control" name="row[wx_webhook]" placeholder="可留空，默认系统配置的" value=""/>
                </div>
            </div>
        <div class="col-md-4 col-xs-12 form-group">
                <label for="c-dd_webhook" class="control-label col-xs-12 col-sm-2">{:__('钉钉机器人')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-dd_webhook"  type="text" class="form-control" name="row[dd_webhook]"  placeholder="可留空，默认系统配置的" value=""/>
                </div>
            </div>

    </div>




    <div class="row">

        <div class="panel panel-default panel-intro col-xs-12 col-md-12">
            <div class="panel-heading">
                <div class="panel-lead"><em>{:__('任务安排')}</em></div>

            </div>
            <div class="panel-body">
                <div id="myTabContent" class="tab-content">
                    <div class="table-responsive" >
                        <table id="table" class="table table-striped table-bordered table-hover table-nowrap" style="margin-bottom: 300px">
                            <thead>
                            <th>{:__('序号')}</th>
                            <th>{:__('任务名称')}</th>
                            <th >{:__('开始时间')}</th>
                            <th>{:__('截止时间')}</th>
                            <th>{:__('安排工时')}</th>
                            <th>{:__('归属部门')}</th>
                            <th>{:__('负责人')}</th>
                            <th>{:__('参与人')}</th>
                            <th>{:__('优先级')}</th>
                            <th>{:__('任务内容')}</th>
                            <th>{:__('操作')}</th>
                            </thead>
                            <tbody>
                            <tr>
                                <td>
                                    1
                                </td>
                                <td >
                                    <input type="text" name="task[0][name]" data-rule="required" >
                                </td>
                                <td class="start_time"  >
                                    <input type="text" name="task[0][start_time]" data-rule="required" class="datetimepicker"  data-date-format="YYYY-MM-DD HH:mm" >
                                </td>
                                <td class="start_time">
                                    <input type="text" name="task[0][end_time]" data-rule="required" class="datetimepicker"  >
                                </td>
                                <td class="plan_hours"><input type="text" name="task[0][plan_hours]" data-rule="required;integer"  ></td>
                                <td>
                                    <select class="form-control selectpicker" data-rule="required" name="task[0][group_id]">
                                        {foreach name="groupdata" item="vo"  index="i" }
                                        <option value="{$i}" >{$vo}</option>
                                        {/foreach}
                                    </select>
                                </td>
                                <td>
                                    <input   data-source="workteam/common/selectpage/model/admin/type/all" data-field="nickname"
                                             class="form-control selectpage" name="task[0][admin_id]" type="text" value="" style="width: 110px" >
                                </td>
                                <td>
                                    <input   data-source="workteam/common/selectpage/model/admin/type/all" data-field="nickname"
                                             class="form-control selectpage" name="task[0][admin_ids]" type="text" value="" data-multiple="true" style="width: 120px">
                                </td>
                                <td class="subtotal">
                                    <select class="form-control selectpicker" data-rule="required" name="task[0][level]">
                                        {foreach name="levelList" item="vo"  index="i" }
                                        <option value="{$i}" >{$vo}</option>
                                        {/foreach}

                                    </select>
                                </td>
                                <td><textarea rows="2" class="remarks" name="task[0][content]" cols="20"></textarea></td>
                                <td>
                                    <button type="button" class="btn btn-primary addRow" >{:__('添加')}</button>
                                    <button type="button" class="btn btn-default delRow" >{:__('删除')}</button>
                                </td>
                            </tr>

                            </tbody>
                        </table>
                    </div>

                </div>
            </div>
        </div>




    </div>

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>

<script>
    var levelList = new Array();
    var groupdata = new Array();
    {foreach name="levelList" item="vo"  index="i" }
    levelList[{$i}]='{$vo}';
    {/foreach}
        {foreach name="groupdata" item="vo"  index="i" }
        groupdata[{$i}]='{$vo}';
        {/foreach}

</script>
